package com.ruoyi.wechat.api;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.wechat.domain.Banner;
import com.ruoyi.wechat.service.IBannerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/wechat/banner")
public class WxBannerController extends BaseController {
    @Autowired
    private IBannerService bannerService;

    /**
     * 查询广告列表
     * @return
     */
    @GetMapping("/list")
    public AjaxResult list()
    {
        //实例化对象，并且对象状态为显示
        Banner banner = new Banner();
        banner.setState("1");

        List<Banner> list = bannerService.selectBannerList(banner);

        //查询的集合以json返回
        return success(list);

    }
}
